package com.gaoqi.common;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;

public class TestStream {
    public static void main(String[] args) {
        Random random = new Random();
        random.ints().limit(10).forEach(System.out::println);
        System.out.println("---------------------------");
        List<String> list = Arrays.asList("abc", "def", "jkl", "dfs","","");
        long count = list.stream().filter(string -> !string.isEmpty()).count();
        System.out.println(count);
        List<String> collect = list.stream().filter(string -> !string.isEmpty()).collect(Collectors.toList());
        System.out.println(collect);
    }
}
